<%@ page import="com.xxxx.entity.User" %>
<%@ page import="java.util.List" %><%--
  Created by IntelliJ IDEA.
  User: 花花
  Date: 2021/6/28
  Time: 11:03
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <meta charset="UTF-8">
    <title>查看用户信息</title>
</head>
<style type="text/css">
    table
    {
        border-collapse: collapse;
        margin: 0 auto;
        text-align: center;
    }
    table td, table th
    {
        border: 1px solid #cad9ea;
        color: #666;
        height: 30px;
    }
    table thead th
    {
        background-color: #CCE8EB;
        width: 100px;
    }
    table tr:nth-child(odd)
    {
        background: #fff;
    }
    table tr:nth-child(even)
    {
        background: #F5FAFA;
    }
</style>
<body>
<%
    List<User> userList= (List<User>) session.getAttribute("userList");

%>
<table border="1" width="450" rules="none" cellspacing="0" cellpadding="0">
    <tr height="50">
        <td colspan="5" align="center">用户信息展示</td>
    </tr>
    <tr align="center" height="30" bgcolor="lightgrey">
        <td width="25%">用户名</td>
        <td>年龄</td>
        <td>宿舍号</td>
        <td>性别</td>
    </tr>
    <% if (userList == null || userList.size() == 0) { %>
    <tr height="100">
        <td colspan="5" align="center">用户信息为空！</td>
    </tr>
    <%
    } else {
        for (int i = 0; i < userList.size(); i++) {
            User user1 = (User) userList.get(i);
            String name = user1.getUserName();
            int age = user1.getUserAge();;
            String room = user1.getUserRoom();
            String sex=user1.getUserSex();
    %>
    <tr align="center" height="50">
        <td><%=name%>
        </td>
        <td><%=age%>
        </td>
        <td><%=room%>
        </td>
        <td><%=sex%>
        </td>
    </tr>
    <%
            }
        }
    %>

</table>

</body>
</html>
